package android.slc.appbase.ui.utils;

import android.content.Context;
import android.content.DialogInterface;
import android.slc.popup.SlcPopup2;

import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.StringUtils;
import com.google.android.material.bottomsheet.SlcBottomSheetAlertDialog2;

/**
 * @author slc
 * @date 2020-08-25 14:21
 */
public class SlcPopupFastUtils {
    public static void showItemDialog(DialogInterface.OnClickListener onClickListener, String... itemArray) {
        showItemDialog(ActivityUtils.getTopActivity(), onClickListener, itemArray);
    }

    public static void showItemDialog(Context context, DialogInterface.OnClickListener onClickListener, String... itemArray) {
        showItemDialog(context, onClickListener, false, itemArray);
    }

    public static void showItemDialog(Context context, DialogInterface.OnClickListener onClickListener, boolean isShowDefButton, String... itemArray) {
        showItemDialog(context, null, onClickListener, isShowDefButton, itemArray);
    }

    public static void showItemDialog(Context context, String title, DialogInterface.OnClickListener onClickListener, String... itemArray) {
        showItemDialog(context, title, onClickListener, false, itemArray);
    }

    public static void showItemDialog(Context context, String title, DialogInterface.OnClickListener onClickListener, boolean isShowDefButton, String... itemArray) {
        /*SlcPopup.BottomNativeAlertDialogBuilder bottomNativeAlertDialogBuilder = new SlcPopup.BottomNativeAlertDialogBuilder(context);
        if (!StringUtils.isEmpty(title)) {
            bottomNativeAlertDialogBuilder.setTitle(title);
        }
        if (isShowDefButton) {
            bottomNativeAlertDialogBuilder.setDefPositiveAndNegativeButton();
        }
        bottomNativeAlertDialogBuilder.setItems(itemArray);
        bottomNativeAlertDialogBuilder.setOnClickListener(onClickListener);
        bottomNativeAlertDialogBuilder.create().show();*/
        SlcBottomSheetAlertDialog2.Builder bottomNativeAlertDialogBuilder = new SlcBottomSheetAlertDialog2.Builder(context);
        if (!StringUtils.isEmpty(title)) {
            bottomNativeAlertDialogBuilder.setTitle(title);
        }
        if (isShowDefButton) {
            //TODO
            //bottomNativeAlertDialogBuilder.setDefPositiveAndNegativeButton();
        }
        bottomNativeAlertDialogBuilder.setItems(itemArray, onClickListener);
        SlcPopup2.createAlertDialogOperate().show(bottomNativeAlertDialogBuilder.create());
    }
}